Skip to content

nic firmware enhancements - #285

Open
jaspals3123 wants to merge 2 commits into
developmentfrom
jaspal_nicfirmware_enhancements
Open

jaspals3123 wants to merge 2 commits into
developmentfrom
jaspal_nicfirmware_enhancements

Conversation

@jaspals3123

Copy link
Copy Markdown
Collaborator

{ "name": "firmware policy", "plugins": { "RdmaPlugin": { "collection_args": {}, "analysis_args": { "expected_nic_firmware": "238.1.168.0" } }, "NicPlugin": { "collection_args": {}, "analysis_args": { "expected_nic_firmware": "238.1.169.0" } }, "NetworkPlugin": { "collection_args": {}, "analysis_args": { "expected_nic_firmware": "238.1.168.0" } } } }

node-scraper --plugin-configs=/home/jaspals/node-scraper/rdma.json

Comment on lines +1 to +5
###############################################################################
#
# MIT License
#
###############################################################################

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the correct license



class NetworkAnalyzer(RegexAnalyzer[NetworkDataModel, None]):
def _validate_firmware_policy(records: list[Dict[str, Any]], policies: Any) -> list[Dict[str, Any]]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function along with _ploicy_matches and _normalize_firmware_version are all shared by network/nic/rdma analyzers. Please move them in utils or something like that so they can share it.


def _firmware_matches(actual: str, expected_pattern: str) -> bool:
try:
return re.fullmatch(expected_pattern, actual, flags=re.IGNORECASE) is not None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think u want to use re.escape instead of fullmatch here?

)
self._parse_ethtool_driver_info(ethtool_info, res_driver.stdout)
ethtool_data[iface.name] = ethtool_info

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should log a warning when ethtool -i cannot be collected for the interface, something like:

else:
    self._log_event(
        category=EventCategory.NETWORK,
        description=(
            f"Error collecting ethtool -i driver info for interface: {iface.name}"
        ),
        data={
            "command": res_driver.command,
            "exit_code": res_driver.exit_code,
            "stderr": res_driver.stderr,
        },
        priority=EventPriority.WARNING,
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants